﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using SupportLibrary;

namespace Automation.Dal.Excel.Model
{
    //*********************************************************************************
    //
    //
    //
    //  TestMap.cs
    //
    //*********************************************************************************

   

    [ExcelSheet(Name = "TMap")]
    public class TestMap : INotifyPropertyChanged
    {

        private string _id;
        private string _page;
        private string _controlname;
        private string _tagname;
        private string _attributevalue;
        private string _xpath;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }


        [ExcelColumn(Name = "ID", Storage = "_id")]
        public string ID
        {
            get { return _id; }
            set
            {
                _id = value;
                SendPropertyChanged("ID");
            }
        }

        [ExcelColumn(Name = "Page", Storage = "_page")]
        public string Page
        {
            get { return _page; }
            set
            {
                _page = value;
                SendPropertyChanged("Page");
            }
        }

        [ExcelColumn(Name = "ControlName", Storage = "_controlname")]
        public string ControlName
        {
            get { return _controlname; }
            set
            {
                _controlname = value;
                SendPropertyChanged("ControlName");
            }
        }

        [ExcelColumn(Name = "TagName", Storage = "_tagname")]
        public string TagName
        {
            get { return _tagname; }
            set
            {
                _tagname = value;
                SendPropertyChanged("TagName");
            }
        }

        [ExcelColumn(Name = "AttributeValue", Storage = "_attributevalue")]
        public string AttributeValue
        {
            get { return _attributevalue; }
            set
            {
                _attributevalue = value;
                SendPropertyChanged("AttributeValue");
            }
        }

        [ExcelColumn(Name = "Xpath", Storage = "_xpath")]
        public string Xpath
        {
            get { return _xpath; }
            set
            {
                _xpath = value;
                SendPropertyChanged("Xpath");
            }
        }

        public bool isValid()
        {
            if (_id == null || _page == null || _tagname == null)
                return false;
            if (_id.Equals("") || _page.Equals("") || _tagname.Equals(""))
                return false;
            if (_controlname == null)
                _controlname = "";
            if (_xpath == null)
                _xpath = "";
            if (_attributevalue == null)
                _attributevalue = "";
            return true;
        }

    }

}
